//
//  Rover.h
//  SSE
//
//  Created by Matt Roman on 10/11/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "openGLheads.h"
#import "Crate.h"

#ifndef MFUNS_H
#define MFUNS_H
#include "Mfuns.h"
#endif

///////////////////////////////////////////////////////////////////
// ROVER PARAMETERS
#define MAXSPEED	100.0  // cm/s
#define LENGTH		0.46
#define WIDTH		0.38
#define HEIGHT		0.22
#define GCLEARANCE	0.23	// ground clearance
#define SENSEDIST	2.0		// rover sensor range
#define SENSEANGLE	PI/4	// rover sensor sweep angle
#define HAZDETECT	20		
#define AUTO		0
#define JOYSTICK	1

@interface Rover : NSObject {
	
	GLshort mode;				// robot mode: JOYSTICK OR AUTO
	Point3f position;			// robot xyz position
	GLfloat alpha;				// robot heading
	Vector3f heading;			// heading unit vector
	int speed;					// robot speed
	float senseRadius;			// sensor radius
	
	Crate *body;				// robot body
	GLfloat mark[9];			// robot forward indicator
	
	Point3f start;				// start position
	Point3f goal;				// goal position
	Point3f way;
	float DisttoGoal;			// distance to goal
	float DisttoWay;			// distance to next waypoint
	Vector3f ToGoal;			// vector to goal
	Vector3f ToWay;				// vector to waypoint

}

- (id)initRover;
- (void)setRoverPositionX:(float)x Y:(float)y Z:(float)z;
- (void)setRoverPosition:(Point3f *)pos;
- (Point3f *)getRoverPosition;
- (void)setAlpha:(float)a;
- (void)Alpha:(float)a;
- (float *)getRoverAlpha;
- (Vector3f *)getHeading;
- (Vector3f *)getGoalVector;
- (void)setSpeed:(float)spd;
- (void)Speed:(float)spd;
- (int *)getRoverSpeed;
- (void)setStart:(Point3f *)s;
- (Point3f *)getStart;
- (void)setGoal:(Point3f *)g;
- (Point3f *)getGoal;
- (void)setWayX:(float)x Y:(float)y;
- (void)drawRover;
- (void)updateRover;
- (void)setSenseRadius:(float)sens;
- (float *)senseRadius;
- (void) reset;
@end
